package top.lingchen.blogapi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.lingchen.blogapi.service.CategoryService;
import top.lingchen.blogapi.vo.Result;

/**
 * @Author 凌宸
 * @create 2021-12-17 下午 4:44
 * @Description
 * @Version 1.0
 */
@RestController
@RequestMapping("/categorys")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public Result categories(){
        return categoryService.findAll();
    }

    @GetMapping("/detail")
    public Result findAllCategoryDetail(){
        return categoryService.findAllCategoryDetail();
    }

    @GetMapping("/detail/{id}")
    public Result findCategoryDetailById(@PathVariable("id") Long categoryId){
        return categoryService.findCategoryDetailById(categoryId);
    }
}
